public class ThreadDemo3 {
    public static int count1 = 0;
    public int count2 = 0;

    public static void main(String[] args) throws InterruptedException {
        int count3 = 10;
        ThreadDemo3 demo3 = new ThreadDemo3();
        Thread t1 = new Thread(() -> {
            for(int i = 0; i < 50000; i++) {
                count1++;
            }
        });

        Thread t2 = new Thread(() -> {
            for(int i = 0; i < 50000; i++) {
                demo3.count2++;
            }
        });

        Thread t3 = new Thread(() -> {
            System.out.println(count3);
        });

        t1.start();
        t2.start();

        t1.join();
        t2.join();
        System.out.println("count1 = " + count1);
        System.out.println("count2 = " + demo3.count2);
    }
}
